package com.etone.smartAudit.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;

import com.etone.smartAudit.vo.certificate.CertificateReplyVO;
import com.etone.smartAudit.vo.certificate.CertificateVoDetail;
import com.etone.smartAudit.vo.certificate.PersonLoginInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 存证单执行人信息
 * </p>
 *
 * @author jiayen
 * @since 2021-06-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("d_certificate_person")
@ApiModel(value = "CertificatePerson对象", description = "存证单执行人信息 ")
public class CertificatePerson implements Serializable {

    /**
     * 0-未执行，1-已阅(扭转)，2-同意，3-不同意
     */
    public static final Integer NO_HAND = 0;
    public static final Integer YET_READ = 1;
    public static final Integer YES_AGREE = 2;
    public static final Integer NO_AGREE = 3;

    /***
     *执行人类型 0-普通执行人，1-领导 2管理员执行
     */
    public static final Integer NORMAL_PERSON = 0;
    public static final Integer LEADER_PERSON = 1;
    public static final Integer ADMIN_PERSON = 2;

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id")
    @TableId(value = "intId", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "执行人名称")
    @TableField("vcName")
    private String name;

    @ApiModelProperty(value = "执行人电话")
    @TableField("vcPhone")
    private String phone;

    @ApiModelProperty(value = "执行人电话")
    @TableField("vcEmail")
    private String email;

    @ApiModelProperty(value = "执行人内容链接")
    @TableField("vcUrl")
    private String url;

    @ApiModelProperty(value = "执行人进入验证码")
    @TableField("vcCode")
    private String code;

    @ApiModelProperty(value = "创建时间")
    @TableField("dtCreateTime")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField("dtUpdateTime")


    private LocalDateTime updateTime;


    @ApiModelProperty(value = "执行人关联的存证单id")
    @TableField("intCerFileid")
    private Integer cerFileid;

    @ApiModelProperty(value = "执行人执行状态;0-未执行，1-已阅，2-同意，3-不同意")
    @TableField("intState")
    private Integer state;

    @ApiModelProperty(value = "执行版本记录;第一位是1后面有执行人则加1")
    @TableField("intVersion")
    private Integer version;

    @ApiModelProperty(value = "执行人意见")
    @TableField("vcContent")
    private String content;

    @ApiModelProperty(value = "执行人附件地址")
    @TableField("vcFileUrl")
    private String fileUrl;

    @ApiModelProperty(value = "执行人文件名称")
    @TableField("vcFileName")
    private String fileName;

    @ApiModelProperty(value = "执行人类型 0-普通执行人，1-领导,3-抄送，4-反馈对象,-1为额外对象")
    @TableField("intType")
    private Integer type;

//    @ApiModelProperty(value = "反馈内容")
//    @TableField("vcFeedBackContent")
//    private String feedBackContent;

    @ApiModelProperty(value = "关联的执行人员id")
    @TableField("intPersonInfoId")
    private Integer personInfoId;


    @ApiModelProperty(value = "扭转人id")
    @TableField("intForwordPersonId")
    private Integer forwordPersonId;


    @ApiModelProperty(value = "上一个指派给当前执行人的人")
    @TableField("intLastPersonId")
    private Integer lastPersonId;

//    @ApiModelProperty(value = "上一个指派给当前执行人的人")
//    @TableField("intLastPersonInfoId")
//    private Integer lastPersonInfoId;


    @ApiModelProperty(value = "执行人执行状态，0-正常执行，1-领导不同意返回跟上一步执行人的状态")
    @TableField("intHandStatus")
    private Integer handStatus;

    @ApiModelProperty(value = "扭转人人名称")
    @TableField(exist = false)
    private String forwordPersonName;

    @TableField(exist = false)
    @ApiModelProperty("执行人上传的附件")
    private List<CertificateUploadFile> files;

    @ApiModelProperty(value = "回复列表")
    @TableField(exist = false)
    private List<CertificateReplyVO> replyList;

    @TableField(exist = false)
    @ApiModelProperty(value = "扭转人信息,执行扭转的时候才有")
    private CertificatePerson forwordPerson;

    @TableField(exist = false)
    @ApiModelProperty(value = "执行返回的详情")
    private PersonLoginInfo details;

    /***
     * 需要接收短信的手机号码
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "需要接收短信的手机号码", hidden = true)
    private String msgPhone;


    @ApiModelProperty(value = "关联的附件id ,多个以逗号隔开，关联 d_project_file")
    @TableField("vcFileIds")
    private String fileIds;

    @ApiModelProperty(value = "记录抄送者id,抄送过来的执行人")
    @TableField("vcOptionPersonId")
    private Integer optionPersonId;

    @ApiModelProperty(value = "记录抄送者名称,抄送人名称")
    @TableField("vcOptionPersonName")
    private String optionPersonName;

    @ApiModelProperty(value = "是否是第一位执行人")
    @TableField("bIsFirst")
    private Boolean isFirst;

    @ApiModelProperty(value = "执行反馈时的对象")
    @TableField(exist = false)
    private CertificatePerson msgPerson;

    public Boolean getIsFirst() {
        return isFirst == null ? false : isFirst;
    }
}
